﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using TongTongMall.Domain.Uow;

namespace TongTongMall.MallWeb.Application.DingTalkRob
{
    public class DingTalkRobService : MallWebApplicationServiceBase, IDingTalkRobService
    {
        //[UnitOfWork(isTransactional: false)]
        public void SendDingTalkRob(string requestJson)
        {
            if (Instance.ApiConfig.DingTalkRobSwitch)
            {
                using (var httpClient = new HttpClient())
                {
                    var robUrl = string.Format(Instance.ApiConfig.DingTalkRobUrl, Instance.ApiConfig.DingTalkRobToken);

                    var result = httpClient.PostAsync(robUrl, new StringContent(requestJson, Encoding.UTF8, "application/json")).Result.Content;//.ReadAsStringAsync();

                }
            }
        }
    }
}
